package com.example.mygame.controller;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.example.mygame.R;
import com.example.mygame.puzzle.WelcomePage;

public class Home extends AppCompatActivity {
    private Button goto2048;

    private Button gotoCat;
    private Button gotoPintu;
    private Button gotoSnake;
    private Button mine;

    private String userName;

    private Intent intent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);

        goto2048 = findViewById(R.id.to2048);

        gotoCat = findViewById(R.id.toCat);

        gotoPintu = findViewById(R.id.topintu);

        gotoSnake = findViewById(R.id.toSnake);

        mine = findViewById(R.id.toMe);

        Intent getDataIntent = getIntent();

        String userName = getDataIntent.getStringExtra("userName");


        goto2048.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Home.this, MainActivity.class);
                startActivity(intent);
            }
        });

        gotoCat.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Home.this, MainActivity2.class);
                startActivity(intent);
            }
        });

        gotoPintu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Home.this, WelcomePage.class);
                startActivity(intent);
            }
        });
        gotoSnake.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Home.this, MainActivity4.class);
                startActivity(intent);
            }
        });
        mine.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Home.this, Mine.class);
                Bundle bundle = new Bundle();
                bundle.putString("userName",userName);
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });

    }
}